//
//  SlideMenu.swift
//  Slide_Menu_Animation
//
//  Created by qingzhou on 2021/5/12.
//

import SwiftUI

struct SlideMenu: View {
    @Binding var selectedTab: String
    @Namespace var animation
    var body: some View {
        VStack(alignment: .leading, spacing: 15, content: {
            Image("data_moment_1_5")
                .resizable()
                .aspectRatio(contentMode: .fill)
                .frame(width: 70, height: 70)
                .cornerRadius(10)
                .padding(.top, 50)
            
            VStack(alignment: .leading, spacing: 6, content: {
                Text("个人主页")
                    .font(.title)
                    .fontWeight(.heavy)
                    .foregroundColor(.white)
                Button(action:{}) {
                    Text("个人简介")
                        .fontWeight(.heavy)
                        .foregroundColor(.white)
                        .opacity(0.7)
                }
            })
            
            VStack(alignment: .leading,spacing: 15) {
                TabButton(title: "主页", image: "house", seletedTab: $selectedTab, animation: animation)
                TabButton(title: "历史", image: "clock.arrow.circlepath", seletedTab: $selectedTab, animation: animation)
                TabButton(title: "通知", image: "bell.badge", seletedTab: $selectedTab, animation: animation)
                TabButton(title: "设置", image: "gearshape.fill", seletedTab: $selectedTab, animation: animation)
                TabButton(title: "帮助", image: "questionmark.circle", seletedTab: $selectedTab, animation: animation)
            }
            .padding(.leading, -15)
            .padding(.top, 50)
            
            Spacer()
            VStack (alignment: .leading, spacing: 6){
                TabButton(title: "退出登录", image: "questionmark.circle", seletedTab: .constant(""), animation: animation)
                    .padding(.leading, -15)
                Text("App version： 1.2.34")
                    .font(.title3)
                    .fontWeight(.semibold)
                    .opacity(0.7)
                    .foregroundColor(.white)
            }
            
            
        })
        .padding()
        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
    }
}

struct SlideMenu_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
